<?php

class View {

    private static $instance = null;
/* ------------------------------------------------------------------------------------------------- */


    private function __construct() {

    }
/* ------------------------------------------------------------------------------------------------- */


    public function render($template, $data) {
        if(is_array($data)) {
            extract($data, EXTR_PREFIX_SAME, 'o'); //if variable exists a new variable $o_ .. will be created
        }
        include '../icloud_files/views/header.php';
        include '../icloud_files/views/'.$template.'.php';
        include '../icloud_files/views/footer.php';
    }
/* ------------------------------------------------------------------------------------------------- */


    public static function get_instance() {
        if(self::$instance == null) {
            self::$instance = new View();
        }
        return self::$instance;
    }
/* ------------------------------------------------------------------------------------------------- */

}